package com.bltec.emergency.service.mgrService.impl;

import com.bltec.emergency.mapper.UserMapper;
import com.bltec.emergency.model.User;
import com.bltec.emergency.service.mgrService.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    UserMapper userMapper;

    @Override
    public boolean add(User user) {
        return userMapper.insert(user);
    }

    @Override
    public boolean deleteUserById(Long id) {
        return userMapper.setDisableById(id);
    }

    @Override
    public boolean updateUserById(User user) {
        return userMapper.updateUserById(user);
    }

    @Override
    public Long getIdByUserName(String username) {
        return userMapper.getIdByUserName(username);
    }

    @Override
    public Long getRoleIdByUserName(String username) {
        return userMapper.getRoleIdByUserName(username);
    }

    @Override
    public List<String> selectAllUsername() {
        return userMapper.selectAllUsername();
    }

    @Override
    public String getPassWordByUserName(String username) {
        return userMapper.getPassWordByUserName(username);
    }

    @Override
    public User getUserById(Long id) {
        return userMapper.getUserById(id);
    }

    @Override
    public User getUserByUsername(String username) {
        return userMapper.getUserByUsername(username);
    }

    @Override
    public List<User> getAll() {
        return userMapper.selectAll();
    }
}
